package com.spring.springboot.sys.task;

import com.spring.springboot.sys.controller.WebSocketServer;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author 宋义州
 * @date 2022-08-07  23:47
 * @description 以60s的频率发送给websocket连接的对象，以防止反向代理的60s超时限制
 */
@Component
@EnableScheduling
public class WebSocketTask {

    /**
     * 添加定时任务,55秒是考虑5秒的延迟,从而保证60s的心跳
     */
    @Scheduled(cron = "0/55 * * * * ?")
    private void configureTasks() {
        WebSocketServer.sendInfo("呼叫动拐,呼叫动拐!", "s_yizhou");
    }

}
